Skip to content

Conversation

@fabiobaltieri
Copy link
Member

@fabiobaltieri fabiobaltieri commented Nov 11, 2024

Add a struct led_dt_spec to hold an LED device and index pointer, some initializer and wrapper APIs.

This allows simpler LED usage, such as:

static const struct led_dt_spec led = LED_DT_SPEC_GET(DT_NODELABEL(led0));
led_on_dt(&led);
led_off_dt(&led);

@fabiobaltieri fabiobaltieri force-pushed the led_dt branch 3 times, most recently from 34cf771 to 619dcc3 Compare November 11, 2024 23:29
@fabiobaltieri fabiobaltieri marked this pull request as ready for review November 11, 2024 23:30
@zephyrbot zephyrbot added the area: LED Label to identify LED subsystem label Nov 11, 2024
Copy link
Member

@gmarull gmarull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor docs nit, otherwise lgtm

gmarull
gmarull previously approved these changes Nov 12, 2024
bbilas
bbilas previously approved these changes Nov 12, 2024
pdgendt
pdgendt previously approved these changes Nov 12, 2024
Copy link
Contributor

@simonguinot simonguinot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @fabiobaltieri,

Thanks for this nice addition to the LED API.

Please can you document it in the release-notes file ?

Just out of curiosity, are there any other additions coming?

See my only comment / question, below.

@fabiobaltieri fabiobaltieri dismissed stale reviews from pdgendt, bbilas, and gmarull via 43af1d4 November 12, 2024 16:54
@fabiobaltieri fabiobaltieri force-pushed the led_dt branch 2 times, most recently from 43af1d4 to 76c31dd Compare November 12, 2024 16:54
@fabiobaltieri
Copy link
Member Author

fabiobaltieri commented Nov 12, 2024

Just out of curiosity, are there any other additions coming?

Nope, this is it, just a oneoff.

pdgendt
pdgendt previously approved these changes Nov 12, 2024
Copy link
Contributor

@simonguinot simonguinot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, add this new API in the release-notes file.

Add a struct led_dt_spec to hold an LED device and index pointer, some
initializer and wrapper APIs.

This allows simpler LED usage, such as:

static const struct led_dt_spec led = LED_DT_SPEC_GET(DT_NODELABEL(led0));
led_on_dt(&led);
led_off_dt(&led);

Signed-off-by: Fabio Baltieri <[email protected]>
@fabiobaltieri
Copy link
Member Author

Please, add this new API in the release-notes file.

Sorry, short attention span... added one line with a reference to the struct, that should refer the macros and everything else.

@zephyrbot zephyrbot added the Release Notes To be mentioned in the release notes label Nov 13, 2024
Copy link
Contributor

@simonguinot simonguinot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks !

Copy link
Member

@henrikbrixandersen henrikbrixandersen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, thanks. It would be good to have some in-tree users of this and some tests for the added macros.

@nashif nashif merged commit 6342eff into zephyrproject-rtos:main Nov 16, 2024
26 checks passed
@fabiobaltieri fabiobaltieri deleted the led_dt branch November 16, 2024 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: LED Label to identify LED subsystem Release Notes To be mentioned in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants